<<<<<<< .mine
<?php
/** PAGE NOT ALLOWED
 * Verify if user called this page through a allowed page.
 * @message: That file cannot be displayed alone.
 */
  $allowed_page=true;
  
if (!isset($allowed_page)) { echo "That file cannot be displayed alone."; exit; }
require_once("d5power.DAO.php");
//Dotk Item class.
class Item extends DAO {

 private $Item_id;
 private $name;
 private $value;
 private $weight;
 private $heal;
 private $stamina;
 private $str;
 private $int;
 private $dex;
 private $self;

 public function getItem_id() {
    return $this->Item_id;
 }

 public function setItem_id($Item_id) {
    $this->Item_id = $Item_id;
 }

 public function getName() {
    return $this->name;
 }

 public function setName($name) {
    $this->name = $name;
 }

 public function getValue() {
    return $this->value;
 }

 public function setValue($value) {
    $this->value = $value;
 }

 public function getWeight() {
    return $this->weight;
 }

 public function setWeight($weight) {
    $this->weight = $weight;
 }

 public function getHeal() {
    return $this->heal;
 }

 public function setHeal($heal) {
    $this->heal = $heal;
 }

 public function getStamina() {
    return $this->stamina;
 }

 public function setStamina($stamina) {
    $this->stamina = $stamina;
 }

 public function getstr() {
    return $this->str;
 }

 public function setstr($str) {
    $this->str = $str;
 }

 public function getint() {
    return $this->int;
 }

 public function setint($int) {
    $this->int = $int;
 }

 public function getdex() {
    return $this->dex;
 }

 public function setdex($dex) {
    $this->dex = $dex;
 }

 public function getSelf() {
    return $this->self;
 }

 public function setSelf($self) {
    $this->self = $self;
 }
 public function loadItem($itemId) {
		$sql = "select
				  item_id, name, value, weight, heal, stamina, str, int, dex, self
				from
				  ITEMS
				where
				  item_id = ?";
		$result = $this->retrieve($sql, array($itemId))->getRow();
		
		 $this->Item_id= $result['item_id'];
         $this->name= $result['name'];
         $this->value= $result['value'];
         $this->weight= $result['weight'];
         $this->heal= $result['heal'];
         $this->stamina= $result['stamina'];
         $this->str= $result['str'];
         $this->int= $result['int'];
         $this->dex= $result['dex'];
         $this->self= $result['self']; 		
		
		
		return $this;	
        }


  /**
  * Function "create"
  * @description Creates a new Item on DB.
  */
  function create($name,$cost,$weight,$heal,$stamina,$str,$int,$dex,$self) {
    $sql = "insert into ITEMS(name, cost, weight, heal, stamina, str, int, dex, self) values (?,?,?,?,?,?,?,?,?)";
    try {
      $this->retrieve($sql, array($name,$cost,$weight,$heal,$stamina,$str,$int,$dex,$self));
      return true;
    }
    catch(Exception $e) {
      return false;
    }
  }


  public function save() {
    $sql = "UPDATE ITEMS SET name= ? , cost= ? , weight= ? , heal= ? , stamina= ? , str= ? , int= ? , dex= ? , self= ? WHERE items_id = ? ";
    $playerResult = $this->retrieve($sql, array($this->name,$this->cost,$this->weight,$this->heal,$this->stamina,$this->str,$this->int,$this->dex,$this->self));
  }
  
  public function delete() {
    $sql = "DELETE from ITEMS  WHERE item_id = ? ";
    $playerResult = $this->retrieve($sql,array($this->Item_id));
  }

}

//  $c = new ITEM();
 // $c->setItem_id(4);
  //print($c->create("potion",3,1,12,12,12,12,12,1));
  //print($c->delete());

 
?>

=======
<?php
/** PAGE NOT ALLOWED
 * Verify if user called this page through a allowed page.
 * @message: That file cannot be displayed alone.
 */
 // $allowed_page=true;
  
if (!isset($allowed_page)) { echo "That file cannot be displayed alone."; exit; }
require_once("d5power.DAO.php");
//Dotk Item class.
class Item extends DAO {

 private $Item_id;
 private $name;
 private $value;
 private $weight;
 private $heal;
 private $stamina;
 private $str;
 private $int;
 private $dex;
 private $self;
 private $image;
 
  public function getImage() {
    return $this->Image;
 }

 public function setImage($Image) {
    $this->Image = $Image;
 }
 
 

 public function getItem_id() {
    return $this->Item_id;
 }

 public function setItem_id($Item_id) {
    $this->Item_id = $Item_id;
 }

 public function getName() {
    return $this->name;
 }

 public function setName($name) {
    $this->name = $name;
 }

 public function getValue() {
    return $this->value;
 }

 public function setValue($value) {
    $this->value = $value;
 }

 public function getWeight() {
    return $this->weight;
 }

 public function setWeight($weight) {
    $this->weight = $weight;
 }

 public function getHeal() {
    return $this->heal;
 }

 public function setHeal($heal) {
    $this->heal = $heal;
 }

 public function getStamina() {
    return $this->stamina;
 }

 public function setStamina($stamina) {
    $this->stamina = $stamina;
 }

 public function getstr() {
    return $this->str;
 }

 public function setstr($str) {
    $this->str = $str;
 }

 public function getint() {
    return $this->int;
 }

 public function setint($int) {
    $this->int = $int;
 }

 public function getdex() {
    return $this->dex;
 }

 public function setdex($dex) {
    $this->dex = $dex;
 }

 public function getSelf() {
    return $this->self;
 }

 public function setSelf($self) {
    $this->self = $self;
 }
 public function load($itemId) {
		$sql = "select
				  item_id, name, value, weight, heal, stamina, str, int, dex, self,Image
				from
				  ITEMS
				where
				  item_id = ?";
		$result = $this->retrieve($sql, array($itemId))->getRow();
		
		 $this->Item_id= $result['item_id'];
         $this->name= $result['name'];
         $this->value= $result['value'];
         $this->weight= $result['weight'];
         $this->heal= $result['heal'];
         $this->stamina= $result['stamina'];
         $this->str= $result['str'];
         $this->int= $result['int'];
         $this->dex= $result['dex'];
         $this->self= $result['self'];
		 $this->Image= $result['Image']; 		 		
		
		
		return $this;	
        }


  /**
  * Function "create"
  * @description Creates a new Item on DB.
  */
  function create($name,$cost,$weight,$heal,$stamina,$str,$int,$dex,$self,$Image) {
    $sql = "insert into ITEMS(name, cost, weight, heal, stamina, str, int, dex, self,Image) values (?,?,?,?,?,?,?,?,?,?)";
    try {
      $this->retrieve($sql, array($name,$cost,$weight,$heal,$stamina,$str,$int,$dex,$self,$Image));
      return true;
    }
    catch(Exception $e) {
      return false;
    }
  }


  public function save() {
    $sql = "UPDATE ITEMS SET name= ? , cost= ? , weight= ? , heal= ? , stamina= ? , str= ? , int= ? , dex= ? , self= ?, Image = ? WHERE items_id = ? ";
    $playerResult = $this->retrieve($sql, array($this->name,$this->cost,$this->weight,$this->heal,$this->stamina,$this->str,$this->int,$this->dex,$this->self,$this->Image,$this->Item_id));
  }
  
  public function delete() {
    $sql = "DELETE from ITEMS  WHERE item_id = ? ";
    $playerResult = $this->retrieve($sql,array($this->Item_id));
  }

}

 //$c = new ITEM();
//$c->setItem_id(4);
 // print($c->create("potion",3,1,12,12,12,12,12,1,"ja.gif"));
  //print($c->delete());

 
?>

>>>>>>> .r41
